package com.zkhz.base.security.service;

import com.zkhz.base.common.service.CurrentUserInfoService;

import java.util.HashMap;
import java.util.Map;

public class DefaultCurrentUserInfoServiceImpl implements CurrentUserInfoService {

    private final Map<String, Object> defaultUserMap = new HashMap<>();

    public DefaultCurrentUserInfoServiceImpl() {
        init();
    }

    @Override
    public <T> T getProperty(String key, Class<T> clazz) {
        return clazz.cast(getUserInfo().get(key));
    }

    public Map<String, ?> getUserInfo() {
        return defaultUserMap;
    }

    public void init() {
        defaultUserMap.put("id", "system");
        defaultUserMap.put("name", "system");
        defaultUserMap.put("loginName", "system");
        defaultUserMap.put("phoneNumber", "");
        defaultUserMap.put("email", "");
        defaultUserMap.put("weChatOpenId", "");
    }
}
